<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课程管理</title>
<link rel="stylesheet" href="js/jquery-ui.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript">
	function refreshTable(){
		$.post('course',{method:'allCourse'},function(data){
			var tbody=$('#tbody');
			tbody.empty();
			for(var i=0;i<data.length;i++){
				var kc=data[i]
				var tr=$('<tr/>');
				tr.append($('<td/>').html(kc.id));
				tr.append($('<td/>').html(kc.name));
				tr.append($('<td/>').html(kc.classHour));
				tr.append($('<td/>').html('<a href="javascript:xg('+kc.id+')">修改</a>'));
				tr.append($('<td/>').html('<a href="javascript:del('+kc.id+')">删除</a>'));
				tbody.append(tr);
			}
		});
	}
	function xg(id){
		$('dialog').dialog
	}
	function del(id){
		if(confirm("是否要删除这条记录？")){
			window.location="course?method=delete&id="+id;
		}
	}
	$(function(){
		refreshTable();
		$('#dialog').dialog({
			autoOpen:false,
			modal:true,
			width:400,
			buttons:{
				'保存':function(){
					
				},
				'退出':function(){
					$('#dialog').dialog('close');
				}
			}
		});
	});
	

</script>
</head>
<body>
	<div class="aaa">
		<h3>课程管理</h3>
		<button onclick="add()">新增</button>
		<table border="1">		
			<thead>
				<tr>
					<th>序号</th>
					<th>课程名称</th>
					<th>课时</th>
					<th colspan="2">操作</th>
				</tr>
			</thead>
			<tbody id="tbody">
			</tbody>
		</table>
	</div>
</body>
</html>